package tasktracker.abstraction;

public class TaskProgressInfo {
	private boolean autoReport;

	private int totalStagesCompleted;
	private int totalStagesCount;

	private int currentStageCompleted;
	private int currentStageCount;

	private String progressText;

	public int getTotalStagesCompleted() {
		return totalStagesCompleted;
	}

	public TaskProgressInfo setTotalStagesCompleted(int totalStagesCompleted) {
		this.totalStagesCompleted = totalStagesCompleted;
		if (autoReport)
			report();
		return this;
	}

	public TaskProgressInfo incrementTotalStagesCompleted() {
		this.totalStagesCompleted++;
		if (autoReport)
			report();
		return this;
	}

	public int getTotalStagesCount() {
		return totalStagesCount;
	}

	public TaskProgressInfo setTotalStagesCount(int totalStagesCount) {
		this.totalStagesCount = totalStagesCount;
		if (autoReport)
			report();
		return this;
	}

	public int getCurrentStageCompleted() {
		return currentStageCompleted;
	}

	public TaskProgressInfo setCurrentStageCompleted(int currentStageCompleted) {
		this.currentStageCompleted = currentStageCompleted;
		if (autoReport)
			report();
		return this;
	}

	public TaskProgressInfo incrementCurrentStagesCompleted() {
		this.currentStageCompleted++;
		if (autoReport)
			report();
		return this;
	}

	public int getCurrentStageCount() {
		return currentStageCount;
	}

	public TaskProgressInfo setCurrentStageCount(int currentStageCount) {
		this.currentStageCount = currentStageCount;
		if (autoReport)
			report();
		return this;
	}

	public String getProgressText() {
		return progressText;
	}

	public TaskProgressInfo setProgressText(String progressText) {
		this.progressText = progressText;
		if (autoReport)
			report();
		return this;
	}

	public boolean isAutoReport() {
		return autoReport;
	}

	public TaskProgressInfo setAutoReport(boolean autoReport) {
		this.autoReport = autoReport;
		return this;
	}

	public TaskProgressInfo clear() {
		this.totalStagesCompleted = 0;
		this.totalStagesCount = 0;
		this.currentStageCompleted = 0;
		this.currentStageCount = 0;
		this.progressText = null;
		return this;
	}

	/**
	 * 快速报告进度变化。不可依赖本方法报告状态改变，必须使用TaskTrackerContext对象的reportStatus方法。
	 */
	public void report() {
		// nop
	}
}
